<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* 水平居中方案一：text-align + inline-block */
    /* .parent {
      height: 400px;
      border: 2px solid #333;
      text-align: center;
    }
    .child {
      width: 65px;
      border: 2px solid pink;
      display: inline-block;
    } */
    /* 水平居中方案二： block + margin */
    /* .parent {
      height: 400px;
      border: 2px solid #333;
    }
    .child {
      width: 65px;
      border: 2px solid pink;
      display: block;
      margin: 0 auto;
    } */
    /* 水平居中方案二： absolute + transform/margin */
    /* .parent {
      height: 400px;
      border: 2px solid #333;
      position: relative;
    }
    .child {
      width: 64px;
      border: 2px solid pink;
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
    } */
    /* 垂直居中方案一： table-cell + vertical-align */
    /* .parent {
      height: 400px;
      border: 2px solid #333;
      display: table-cell;
      vertical-align: middle;
    }
    .child {
      width: 64px;
      border: 2px solid pink;
    } */
    .parent {
      width: 200px;
      border: 2px solid pink;
    }
    .child {
      border: 2px solid blue;
    }
  </style>
</head>
<body>
  <div class="parent">
    <div class="child">孩子元素</div>
  </div>
</body>
</html>